package com.events;

import com.sprites.Ball;

public class DoubleBallSpeedEvent extends Event {
	private Ball ball;

	// this event is started if a ball hits the double speed special
	// brick(DoubleBallSpeedBrick.java)
	// This last for a given time(duration)
	/**
	 * Constructor
	 * 
	 * @param duration
	 * @param ball
	 */
	public DoubleBallSpeedEvent(float duration, Ball ball) {
		super(duration);
		this.ball = ball;
		ball.setSpeed(2 * ball.getSpeed().getX(), 2 * ball.getSpeed().getY());
	}

	@Override
	/**
	 * Method that Method that reverts the effect of the event
	 */
	public void endEvent() {
		ball.setSpeed(ball.getSpeed().getX() / 2, ball.getSpeed().getY() / 2);
	}

}
